Skip to content

Create a GroupProfile for the Staff Content Team #6587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions kitsune/groups/migrations/0004_add_staff_content_team_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from django.db import migrations


def create_staff_content_team_profile(apps, schema_editor):
Group = apps.get_model('auth', 'Group')
GroupProfile = apps.get_model('groups', 'GroupProfile')

try:
group = Group.objects.get(name='Staff Content Team')
except Group.DoesNotExist:
raise Exception("Staff Content Team group must exist before running this migration")

if not GroupProfile.objects.filter(group=group).exists():
GroupProfile.objects.create(
group=group,
information='Staff Content Team group for content management.',
information_html='Staff Content Team group for content management.'
)


def remove_staff_content_team_profile(apps, schema_editor):
Group = apps.get_model('auth', 'Group')
GroupProfile = apps.get_model('groups', 'GroupProfile')

try:
group = Group.objects.get(name='Staff Content Team')
except Group.DoesNotExist:
return

GroupProfile.objects.filter(group=group).delete()


class Migration(migrations.Migration):
dependencies = [
('groups', '0003_auto_20250218_1157'),
]

operations = [
migrations.RunPython(
create_staff_content_team_profile,
remove_staff_content_team_profile
),
]